package cn.wd.user.service.impl;


import cn.wd.common.util.StrUtils;
import cn.wd.user.domain.entity.LoginLog;
import cn.wd.user.domain.mapper.LoginLogMapper;
import cn.wd.user.page.PageResult;
import cn.wd.user.qo.LoginLogPage;
import cn.wd.user.qo.QueryObject;
import cn.wd.user.service.ILoginLogService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> implements ILoginLogService {


    // @Override
    // public void save(LoginLog obj) {
    //     mapper.insert(obj);
    // }
    //
    // @Override
    // public void updateById(LoginLog obj) {
    //     mapper.updateByPrimaryKey(obj);
    // }
    //
    // @Override
    // public void deleteById(Long id) {
    //     mapper.deleteByPrimaryKey(id);
    // }
    //
    // @Override
    // public LoginLog selectById(Long id) {
    //     return mapper.selectByPrimaryKey(id);
    // }
    //
    // @Override
    // public List<LoginLog> selectAll() {
    //     return mapper.selectAll();
    // }

    @Override
    public void batchDelete(Long[] deletedIds) {
        baseMapper.batchDelete(deletedIds);
    }

    @Override
    public Page<LoginLog> listLoginLogPage(LoginLogPage qo) {
        LambdaQueryWrapper<LoginLog> wrapper = new LambdaQueryWrapper<LoginLog>()
                .like(StrUtils.hasText(qo.getKeyword()), LoginLog::getName, qo.getKeyword());
        return baseMapper.selectVoPage(qo, wrapper, LoginLog.class);
    }
}
